package com.server.llh.llhserverwork.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.llh.llhsuppliers.R;
import com.server.llh.llhserverwork.bean.Account;
import com.server.llh.llhserverwork.bean.AccountLiuShuiInfo;

import java.util.List;

/**
 * Created by ZTF on 2017-06-14.
 */

public class AccountListAdapter extends BaseAdapter {
    Context context;
    List<AccountLiuShuiInfo> accountList;
    public AccountListAdapter(Context context, List<AccountLiuShuiInfo> accountList){
        this.context=context;
        this.accountList=accountList;
    }

    @Override
    public int getCount() {
        if (accountList==null&&accountList.size()==0){
            return  0;
        }
        return accountList.size();
    }

    @Override
    public Object getItem(int position) {
        return accountList.get(position);
    }


    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        VierHolder h = new VierHolder();
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(
                    R.layout.llh_query_account_info, null);
            h.orgNameTxt = (TextView) convertView.findViewById(R.id.orgNameTxt);
            h.info_time_Txt = (TextView) convertView.findViewById(R.id.info_time_Txt);
            h.info_status_Txt = (TextView) convertView.findViewById(R.id.info_status_Txt);
            h.qianri_yue_Txt = (TextView) convertView.findViewById(R.id.qianri_yue_Txt);
            h.qianbi_yue_Txt = (TextView) convertView.findViewById(R.id.qianbi_yue_Txt);
            h.benci_yue_Txt = (TextView) convertView.findViewById(R.id.benci_yue_Txt);
            h.bencifs_yue_Txt = (TextView) convertView.findViewById(R.id.bencifs_yue_Txt);
            h.bencifs_yue_Txt = (TextView) convertView.findViewById(R.id.bencifs_yue_Txt);
            h.czmx_Txt = (TextView) convertView.findViewById(R.id.czmx_Txt);
            h.bz_Txt = (TextView) convertView.findViewById(R.id.bz_Txt);
            h.czy_Txt = (TextView) convertView.findViewById(R.id.czy_Txt);
            convertView.setTag(h);
        } else {
            h = (VierHolder) convertView.getTag();
        }
        AccountLiuShuiInfo  payQuery= accountList.get(position);
        h.orgNameTxt.setText(""+payQuery.getJgmc());
        h.bencifs_yue_Txt.setText("本次发生："+payQuery.getBcfs());
        h.czmx_Txt.setText("操作明细："+payQuery.getCzmx());
        h.bz_Txt.setText("备注："+payQuery.getBz());
        h.czy_Txt.setText("操作员："+payQuery.getCzy());
        h.benci_yue_Txt.setText("本次余额："+payQuery.getBcye());
        h.info_status_Txt.setText("结算状态："+payQuery.getJsbz());
        h.qianri_yue_Txt.setText("前日余额："+payQuery.getQrye());
        h.qianbi_yue_Txt.setText("前笔余额："+payQuery.getQbye());
        h.info_time_Txt.setText(""+payQuery.getFssj());
        return convertView;
    }

    class VierHolder {
        TextView orgNameTxt,info_time_Txt,benci_yue_Txt,czy_Txt,bz_Txt,czmx_Txt,bencifs_yue_Txt,info_status_Txt,qianri_yue_Txt,qianbi_yue_Txt;

    }

}
